{% extends 'cms/base.html'%}

{% block title %}新闻分类{% endblock %}

{% block content-header %}
  <h1>新闻分类</h1>
{% endblock %} 

{% block content %}
  <div class="row">
    <div class="col-md-12">
      <div class="box box-primary">
        <div class="box-header">
          <a href="{% url 'xfzauth:add_category'%}"><button class="btn btn-primary pull-right">添加分类</button></a>
        </div>
        <div class="box-body">
          <table class="table table-bordered">
            <thead>
              <tr>
                <th>分类名称</th>
                <th>新闻数量</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              {% for category in categories %}
                <tr>
                  <td>{{ category.name }}</td>
                  <td>20</td>
                  <td>
                    <a href="{% url 'xfzauth:edit_category' category_name=category.name %}"><button class="btn btn-warning btn-xs">编辑</button></a>
                    <a href="{% url 'xfzauth:delete_category' category_name=category.name %}"><button class="btn btn-danger btn-xs">删除</button></a>
                  </td>
                </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
{% endblock %} 